<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%layout("/WEB-INF/view/common/inc/admin_head.html",{title:'资源添加', styles:'bootstrap,font-awesome,animate,style,dtvalidate,layer,chosen'}){%>
    <style type="text/css">
        body{padding-top:10px;}
    </style>
    <%}%>
</head>
<body>
<!-- START 内容部分 -->
<div class="container" >
    <form class="form-horizontal" id="info-form" method="post" autocomplete="off" style="margin: auto">
        <div class="form-group">
            <div class="col-xs-12">
                <input type="text" id="createPlanNo" readonly name="createPlanNo" value="${createPlan.createPlanNo}"  class="form-control"  />
                <input type="hidden" id="createId" readonly name="createId" value="${createPlan.id}"  class="form-control"  />
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-sm-2">供应商</label>
            <div class="col-sm-6">
                <select id="createSupplier"  name="createSupplier"  class="form-control" xm-select="createSupplierId" xm-select-radio xm-select-search>
                    <option value=""></option>
                    <%for(var dict in supplier){%>
                    <option value="${dict.supplierName}">${dict.supplierName}</option>
                    <%}%>
                </select>
            </div>
        </div>
        <div class="form-group ">
            <label class="col-xs-12 control-label">实际运费</label>
            <div class="col-xs-3">
                <select class="form-control" id="createMoneyType" name="createMoneyType">
                    <option value="">币种</option>
                    <option value="人民币">人民币</option>
                    <option value="美金">美金</option>
                    <option value="加元">加元</option>
                    <option value="欧元">欧元</option>
                    <option value="英镑">英镑</option>
                    <option value="日元">日元</option>
                    <option value="埃及镑">埃及镑</option>
                </select>
            </div>
            <div class="col-xs-9" >
                <input type="text" id="createMoney" name="createMoney" onkeyup="value=value.replace(/[^\d?.{1}\d{2}]/g,'')"   class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="button" class="save-btn btn btn-primary">
                    <i class="fa fa-save"></i> 保存
                </button>
            </div>
        </div>
    </form>
</div>
<!-- END 内容部分 -->

<!-- START 公共脚本 -->
<%layout("/WEB-INF/view/common/inc/admin_js.html",{modules:'jquery,bootstrap,dtvalidate,dtvalidate-lang-zh_cn,laydate,layer,chosen,chosen-demo'}){}%>
<!-- END 公共脚本 -->
<script>
    var cvalidator;
    $(function(){
        formSelects.render('createPlanPlace');
        //初始化验证器
        cvalidator = $.fn.dlshouwen.validator.init($('#info-form'));
        //提交表单
        $('.save-btn').on('click',function(){

            var createSupplierId=formSelects.value('createSupplierId', 'nameStr');
            if(createSupplierId==''){
                parent.layer.msg('请选择供应商！',{icon: 0,time:1500,shade: [0.8, '#393D49']});
                return;
            }
            var createMoneyType=$("#createMoneyType").val();
            if(createMoneyType==''){
                parent.layer.msg('请选择币种！',{icon: 0,time:1500,shade: [0.8, '#393D49']});
                return;
            }

            //活动结束时间
            var createMoney=$("#createMoney").val();
            if(createMoney=='') {
                parent.layer.msg('请填写实际运费！', {icon: 0, time: 1500, shade: [0.8, '#393D49']});
                return;
            }

            //数据提交
            $.post('/bbpk/physical/createFreight/save.do',$('#info-form').serialize(),function(data){
                if( data.ok ){
                    parent.layer.msg(data.msg,{icon:1,time:1500,shade: [0.8, '#393D49']}, function(){
                        parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭弹窗
                    });
                }else{
                    parent.layer.msg(data.msg,{icon: 0,time:1500,shade: [0.8, '#393D49']});
                }
            });
        });

        //返回
        $('.return-btn').on('click',function(){
            parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭弹窗
        });
    });
</script>
</body>
</html>